from datetime import datetime
from typing import Optional, List
from pydantic import BaseModel, Field
from app.core.constants import FileStatusEnum
from app.schemas.file_schemas import FileResponse


class FileListFilter(BaseModel):
    """文件列表筛选条件"""

    provider_id: Optional[int] = Field(None, description="存储供应商ID")
    provider_name: str = Field(..., description="存储供应商名称")
    storage_path: str = Field(..., description="存储路径")
    name: Optional[str] = Field(None, description="文件名称")
    uploader_id: Optional[int] = Field(None, description="上传者ID")
    status: Optional[FileStatusEnum] = Field(None, description="文件状态")


class FileDetailResponse(FileResponse):
    """文件详情响应"""

    provider_id: int = Field(..., description="存储供应商ID")
    provider_name: str = Field(..., description="存储供应商名称")
    storage_path: str = Field(..., description="存储路径")
    md5: str = Field(..., description="文件MD5")
    status: FileStatusEnum = Field(..., description="文件状态")
    uploader_id: int = Field(..., description="上传者ID")


class FileMigrateRequest(BaseModel):
    """文件迁移请求"""

    file_ids: List[int] = Field(..., description="文件ID列表")
    target_provider_id: int = Field(..., description="目标存储供应商ID")


class FileStatusUpdateRequest(BaseModel):
    """文件状态更新请求"""

    file_ids: List[int] = Field(..., description="文件ID列表")
    status: FileStatusEnum = Field(..., description="目标状态")
